package com.luxk.db.file;

import com.luxk.db.common.ImpactException;

public interface DBFile {
	
	public static final int FILE_MODE_SYNC   = 0x1;
	public static final int FILE_MODE_DIRECT = 0x2;
	
	public void init(DBFileType type, int fileId, String name, String path)
			throws ImpactException;
	
	public DBFileType getType();
	public int getFileId();
	public String getName();
	public String getPath();
	public long getSize();
	
	public DBFileStatus getStatus();
	public void setStatus(DBFileStatus status);
	
	public void create(long size) throws ImpactException;
	public void open() throws ImpactException;
	public void close() throws ImpactException;
	public void delete() throws ImpactException;
	public long extend(long incSize) throws ImpactException;
	public long truncate(long remainSize) throws ImpactException;
	
	public int read(long offset, int size, byte[] buf) throws ImpactException;
	public int write(long offset, int size, byte[] buf) throws ImpactException;
	
	public int readAioSubmit(long offset, int size, byte[] buf)
			throws ImpactException;
	public boolean readAIOWait() throws ImpactException;
	
	public int writeAIOSubmit(long offset, int size, byte[] buf)
			throws ImpactException;
	public boolean writeAIOWait() throws ImpactException;
}
;